﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClass;

namespace ProducerBO
{
    public class STUDIO
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _S_ID =-99;
        private long _S_P_ID=-99;
        private string _S_NAME = "";
        private string _S_LOCATION = "";
        private bool _ISDELETED = false;
        private bool _ISACTIVE= true;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public bool ISACTIVE
        {
            get
            {
                return _ISACTIVE;
            }
            set
            {
               _ISACTIVE = value;
            }
        }
        public long S_ID
        {
            get
            {
                return _S_ID;
            }
            set
            {
                _S_ID = value;
            }
        }
        public long S_P_ID
        {
            get
            {
                return _S_P_ID;
            }
            set
            {
               _S_P_ID  = value;
            }
        }
        public string S_NAME
        {
            get
            {
                return _S_NAME;
            }
            set
            {
                _S_NAME = value;
            }
        }
   
        public string S_LOCATION
        {
            get
            {
                return _S_LOCATION;
            }
            set
            {
                _S_LOCATION = value;
            }
        }
      
        
        public long SaveRecord()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@S_ID", S_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@S_P_ID", S_P_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@S_NAME",S_NAME , DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@S_LOCATION", S_LOCATION, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);


                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                return DAC.Save("STUDIO_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long pno, string pname, Decimal price, string category, string color, string photo, bool isdeleted, string andor) 
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@S_ID", S_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@S_P_ID", S_P_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@S_NAME", S_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@S_LOCATION", S_LOCATION, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@paraandor", andor, DbType.AnsiString, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6 };
                DataTable dt = DAC.Select("STUDIO_GET", dbparamcall);
                return dt;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }

    }
}